function e(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

var t, a = function(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}(require("../../../utils/tools.js")), i = (getApp(), e(require("./modules/base-canvas-palette.js")), 
e(require("../../../utils/wx-promisify/wx-promisify.js"))), r = e(require("./modules/handle-create-img.js"));

(0, i.default)(wx.getSetting);

Page({
    data: {
        pageName: "recruit",
        interstitialAd: ""
    },
    onLoad: function(e) {
        t = this;
    },
    onReady: function() {
        var e = {
            action: "recruit",
            contr: "my",
            token: wx.getStorageSync("token")
        };
        a.default.request(e, function(e) {
			
		var item = {
				"pageName": "tx",
				"text": "探险",
				"iconPath": "https://www.shangjinya.com/addons/bh_farm/template/static/images/xcx/a17.png",
				"selectedIconPath": "https://www.shangjinya.com/addons/bh_farm/template/static/images/xcx/a15.png",
				"index": 1,
				"visible": true 
			}
			var tabs = e.info.list   
			var newTabs = [tabs[0],item, tabs[3], tabs[4]]
			e.info.list = newTabs
            t.setData(e.info), wx.createInterstitialAd && e.info.screen_ad && "" == t.data.interstitialAd && (t.data.interstitialAd = wx.createInterstitialAd({
                adUnitId: e.info.screen_ad
            }), t.data.interstitialAd.onError(function(e) {
                console.log(e);
            }), t.data.interstitialAd.show().catch(function(e) {
                console.error(e);
            }));
        });
    },
    onShow: function() {},
    navigatorSwitch: function(e) {
        console.log(e.detail.pageName);
        var t = e.detail.pageName;
        if (t != this.data.pageName) {
            if ("index" == t) a = "/bh_farm/pages/index/index";else if ("tx" == t) a = "/bh_farm/pages/tx/tx"; else if ("mine" == t) a = "/bh_farm/pages/my/my"; else if ("pdd" == t) a = "/bh_farm/pages/pdd/pdd"; else if ("db" == t) var a = "/bh_farm/pages/treasure/treasure";
            wx.redirectTo({
                url: a
            });
        }
    },
    savePoster: function() {
        var e = [ {
            type: "image",
            url: this.data.share_image_bg,
            css: {
                top: "0rpx",
                left: "0rpx",
                width: "720px",
                height: "960px",
                mode: "scaleToFill"
            }
        }, {
            type: "image",
            url: this.data.qr_code,
            css: {
                top: "637px",
                left: "250px",
                width: "225px",
                height: "225px",
                borderRadius: "100px",
                borderWidth: "1px",
                borderColor: "#ffffff"
            }
        } ];
        this.data.poster = {
            content: e
        }, console.log(e), wx.showLoading({
            title: "正在生成海报",
            mask: !0
        }), r.default.doCreateImg(this);
        try {
            getApp().sensors.track("XMClick", {
                ck_module: "保存海报",
                page: ""
            });
        } catch (e) {}
    },
    imgErr: function(e) {
        console.log(22222), r.default.createImgFail(e);
    },
    onImgOK: function(e) {
        r.default.createImgScuess(this, e);
    },
    onShareAppMessage: function() {
        return {
            title: this.data.share.text,
            imageUrl: this.data.share.images,
            path: "bh_farm/pages/index/index?parent_id=" + this.data.share.member_id
        };
    }
});